package com.aliothservice.catfish.order.data;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.data.annotation.Id;

public class UserOrder {
	
	public Map<String, Object> toMap() {
		Map<String, Object> map = new HashMap<String, Object>();
		
		map.put("id", this.getId());
		if (null != this.getVehicle()) {
			map.put("vehicle", this.getVehicle());
		}
		if (null != this.getWarehouse()) {
			map.put("warehouse", this.getWarehouse());
		}
		if (null != this.getProduct()) {
			map.put("product", this.getProduct());
		}
		DateFormat fullFormatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");
		map.put("creationDate", fullFormatter.format(this.getCreationDate()));
		
		return map;
	}

	@Id
	private String id;
	
	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	// who owns this order
	private String userId;
	
	private List<Map<String, Object>> vehicle;
	private List<Map<String, Object>> warehouse;
	private List<Map<String, Object>> product;
	
	private Date creationDate;
	
	public List<Map<String, Object>> getVehicle() {
		return vehicle;
	}
	
	public void setVehicle(List<Map<String, Object>> vehicle) {
		this.vehicle = vehicle;
	}

	public List<Map<String, Object>> getWarehouse() {
		return warehouse;
	}

	public void setWarehouse(List<Map<String, Object>> warehouse) {
		this.warehouse = warehouse;
	}

	public List<Map<String, Object>> getProduct() {
		return product;
	}

	public void setProduct(List<Map<String, Object>> product) {
		this.product = product;
	}

	public String getUserId() {
		return userId;
	}

	public void setUserId(String userId) {
		this.userId = userId;
	}

	public Date getCreationDate() {
		return creationDate;
	}

	public void setCreationDate(Date creationDate) {
		this.creationDate = creationDate;
	}

}
